package com.indianindie;

import javax.microedition.khronos.opengles.GL10;

public class SRGameDisplayObject extends SRGameComponent{

	


	public final static int DISPLAY_BLOCK_WIDTH = 40;
	public final static int DISPLAY_BLOCK_HEIGHT = 30;

	private float camera_position;
	
	private float position_x;
	private float position_y;
	private float object_width;
	private float object_height;
	private int texture_id;

	private int texture_resource;

	public SRGameDisplayObject( float position_x,
			float position_y, float object_width, float object_height,
			int texture_id, int texture_resource, boolean noUpdate) {
		super();
		this.camera_position = 0.0f;
		this.position_x = position_x;
		this.position_y = position_y;
		this.object_width = object_width;
		this.object_height = object_height;
		this.texture_id = texture_id;
		this.texture_resource = texture_resource;
		this.noUpdate = noUpdate;
	}
	
	public int getTexture_resource() {
		return texture_resource;
	}


	public void setTexture_resource(int texture_resource) {
		this.texture_resource = texture_resource;
	}


	private boolean noUpdate = false;
	
	
	public boolean inView(SRGameDisplayObject gameObject) {
		if((gameObject.getPosition_x() > this.camera_position+SRGameDisplayObject.DISPLAY_BLOCK_WIDTH) || gameObject.getPosition_x()+gameObject.getObject_width() < this.camera_position) 
			return false;
		else
			return true;
	}
	
	
	public float getPosition_x() {
		return position_x;
	}

	public void setPosition_x(float position_x) {
		this.position_x = position_x;
	}

	public float getPosition_y() {
		return position_y;
	}

	public void setPosition_y(float position_y) {
		this.position_y = position_y;
	}

	public float getObject_width() {
		return object_width;
	}

	public void setObject_width(float object_width) {
		this.object_width = object_width;
	}

	public float getObject_height() {
		return object_height;
	}

	public void setObject_height(float object_height) {
		this.object_height = object_height;
	}

	public int getTexture_id() {
		return texture_id;
	}

	public void setTexture_id(int texture_id) {
		this.texture_id = texture_id;
	}

	public boolean isNoUpdate() {
		return noUpdate;
	}

	public void setNoUpdate(boolean noUpdate) {
		this.noUpdate = noUpdate;
	}


	public boolean repeatTexture() {
		// TODO Auto-generated method stub
		return false;
	}


	public void setUpOpenGL(GL10 gl) {
		// TODO Auto-generated method stub
		gl.glTranslatef(this.position_x, this.position_y, 0.0f);
		gl.glScalef(this.object_width,this.object_height , 1.0f);
	}


}
